// API Client Module v2.3.4 class APIClient { constructor(baseURL = 'https://api.binance.org') { this.baseURL = baseURL; this.apiKey = null; this.timeout = 30000; } async initialize(apiKey) { this.apiKey = apiKey; await this._validateConnection(); } async _validateConnection() { try { const response = await this._request('/api/v1/ping'); return response.status === 200; } catch { return false; } } async getTokenInfo(address) { return await this._request(`/api/v1/token/${address}`); } async getPairInfo(address) { return await this._request(`/api/v1/pair/${address}`); } async getTransactions(address, limit = 50) { return await this._request(`/api/v1/transactions`, { address, limit }); } async _request(endpoint, params = {}) { const url = new URL(endpoint, this.baseURL); Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value) ); const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), this.timeout); try { const response = await fetch(url, { headers: this.apiKey ? { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' } : undefined, signal: controller.signal }); if (!response.ok) { throw new Error(`API Error: ${response.status}`); } return await response.json(); } finally { clearTimeout(timeoutId); } } } export const apiClient = new APIClient();